package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.GoodsListBean;
import com.mz.ozy.bean.ObShopBean;
import com.mz.ozy.mvp.model.ObShopFragmentModel;
import com.mz.ozy.mvp.model.ObShopModel;
import com.mz.ozy.mvp.view.ObShopContract;
import com.mz.ozy.mvp.view.ObShopFragmentContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

/**
 * @author wansong
 * @description:
 * @date :2020/9/24 16:33
 */
public class ObShopFragmentPersenter extends BasePresenterImpl<ObShopFragmentContract.View> implements ObShopFragmentContract.Persenter {


    private ObShopFragmentModel mModel;


    public ObShopFragmentPersenter() {
        mModel = new ObShopFragmentModel();

    }

    //获取数据列表
    @Override
    public void getList(Context context,String page,String orderBy,String type,String content,String orderType){
        mModel.getList(context, page,orderBy,type,content,orderType)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<ObShopBean>(mView) {

                    @Override
                    public void onSuccesss(ObShopBean jsonObject) {
                        mView.getListSuccess(jsonObject);
                    }
                });

    }

}
